<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 select-info">
			<form id="role-form">
				<div class="select-list">
					<ul>
						<li>
							操作用户：<input type="text" name="operateUser"/>
						</li>
						<li>
							状态：<select name="state" th:with="type=${@dict.getType('module_upload_data_state')}">
							<option value="">所有</option>
							<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
						</select>
						</li>
						<li class="time">
							<label>上传日期： </label>
							<input type="text" class="layui-input" id="startTime" placeholder="开始时间" name="params[uploadBeginTime]"/>
							<span>-</span>
							<input type="text" class="layui-input" id="endTime" placeholder="结束时间" name="params[uploadEndTime]"/>
						</li>
						<li class="time">
							<label>修改日期： </label>
							<input type="text" class="layui-input" id="editStartTime" placeholder="开始时间" name="params[editBeginTime]"/>
							<span>-</span>
							<input type="text" class="layui-input" id="editEndTime" placeholder="结束时间" name="params[editEndTime]"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()"><i class="fa fa-download"></i>&nbsp;下载</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>
		<div class="btn-group hidden-xs" id="toolbar" role="group">
			<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.fileupload()" shiro:hasPermission="module-edu:upload-data:upload-data">
				<i class="fa fa-plus"></i> 上传资料
			</a>
			<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="module-edu:upload-data:remove">
				<i class="fa fa-trash-o"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-info table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module-edu:upload-data:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module-edu:upload-data:remove')}]];
        var datas = [[${@dict.getType('sys_normal_disable')}]];
        var prefix = ctx + "module/edu/upload-data"
        $(function() {
            var options = {
                url: prefix + "/list",
                fileuploadUrl: prefix + "/fileupload",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "教务科-上传资料",
                columns: [{
		            checkbox: true
		        },{
					field : 'uploadId', 
					title : '序号'
				},{
					field : 'operateUser', 
					title : '操作用户'
				},{
					field : 'uploadDate', 
					title : '上传日期'
				},{
					field : 'editDate', 
					title : '修改日期'
				},{
					field : 'state', 
					title : '状态',
                    align: 'center',
                    formatter: function(value, row, index) {
					    if(value == "1"){
					        return '<span class="badge badge-primary">存在</span>';
						}
					    return '<span class="badge badge-danger">丢失</span>';
                    }
				},{
					field : 'fileName', 
					title : '文件名称'
				},{
					field : 'filePath', 
					title : '文件路径'
				},{
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.uploadId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.uploadId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
            layui.use('laydate', function() {
                var laydate = layui.laydate;
                laydate.render({ elem: '#editStartTime', theme: 'molv' });
                laydate.render({ elem: '#editEndTime', theme: 'molv' });
            });
        });
    </script>
</body>
</html>